Introduce your problem

Give a brief introduction to your research and identify how your “Advanced Topic” plays into what you are hoping to do. For example, if you are just starting out on your project and your topic is “Study Design” you might be interested in developing a spatially informed sampling/stratification scheme.Or maybe your work is going to have a big public outreach component that you’d like to support with some nice interactive maps. Give us a sense for what “success” would look like - what is your ideal end product for the analysis/approach you’re testing out. This will help us figure out if the tools you tried were successful.

I wanted to focus on using bivariate mapping to display how one variable varys with another, across space. After making bivariate maps that were static, I wanted to see if I could add more information about the data, or an additional dataset using some interactive features on the map. The purpose of the interactive map would be to better visualize complex datasets, as well as increase accessibilty for the public and policymakers. The next step would be to employ the same techniques in a shiny application for publication in an appropriate outlet. Here, I’m using publically available data that was used in the demonstration I followed, household income, personal income, and the Gini Coefficient. This data was derived from the 2017 American Community Survey 5-Year Estimates.

PSUEDOCODE!!

Before you get started programming all of the potential things you could do during the course of this demo. Lay out the steps you’ll need to get there (see below for what I mean). You don’t have to actually code these things (yet) just help us see how you’re approaching the problem.

###Libraries

#load the libraries - tell us which packages you're using and why
library(tidycensus) #load the ACS data; note - you'll need your own census keycode to access the data
library(dplyr) #data wrangling 
library(magrittr) #data wrangling
library(sf) #we are using tidycensus which will return a sf-class dataframe
library(ggplot2) #plotting the data
library(leaflet) #interactive map
library(leaflet.extras) #extra goodies for prettying up the interactive map 
library(htmlwidgets)
library(htmltools)

###load your data - which datasets do you need?

ACS table and variable names

#Here, I’m using two datasets that I want to see vary together household income and personal income, as well as the Gini Coefficient which I want to see as a popup on the map.

###Organize the data - what form should the data be in? A list? how many elements, a data frame? how many rows and columns?

#I want a spatial dataframe in sf form to play nice with tidycensus, with each row (44) to be an Idaho county and each column (3) to be a variable, as well as the GEOID as a unique identifier, the pretty name of the County, and geometries for each county.

###Analysis/processing step 1 - what are you hoping to do here, why?

#Bring the data I want from ACS - make sure if looks right.

##Create bins or ‘breaks’ that will indicate which level of income or Gini Coefficient the county falls into, compared to all the counties in the state of Idaho.

###Analysis/processing step 2 - what are you hoping to do here, why?

##Map the incomes based on the breaks I calculated.

#Add interactive features (i.e., actual values of the variables)

#Check the outcomes? How will you know if your steps worked?

#Display the map

Introduce the packages

Given your psuedo code, where is the critical step? What packages and functions are you considering to help you complete this step? Why did you choose them?

Evaluate your choices

Use profiling and benchmarking to evaluate which of your options is likely to be the fastest. How does the syntax and/or ease of use of that function impact your decision of whether or not to use it? (For example, velox is much faster than raster, but it’s less well documented and the syntax is strange to get used to).

Show us your final product

Did you make a map? Let’s see it. Did you plot some data that you extracted with raster? show us that plot. Did you have an idea of how the data should look after you were done processing it? Were you successful? What went wrong

Defining the breaks and sticking the LEGEND on the interactive map is the hardest part of this whole thing.

Reflect

Write a few sentences on what you learned from this exercise. How has your skill improved? What do you wish you understood better? What do you imagine your next steps to be?

Once you’re done push the “knit” button to create the html page from your Rmarkdown document. If you’ve got questions, let me know!!